package cn.itcast.service.impl;

import cn.itcast.entity.FarmingRecord;
import cn.itcast.mapper.FarmingMapper;
import cn.itcast.service.FarmingService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

@Service
public class FarmingServiceImpl extends ServiceImpl<FarmingMapper, FarmingRecord> implements FarmingService {
    
    @Override
    public FarmingRecord getOne(FarmingRecord farmingRecord) {
        QueryWrapper<FarmingRecord> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("farmer_name", farmingRecord.getFarmerName())
                   .eq("pool_number", farmingRecord.getPoolNumber())
                   .eq("record_date", farmingRecord.getRecordDate())
                   .eq("record_type", farmingRecord.getRecordType());
        return this.getOne(queryWrapper);
    }
} 